package cn.yuanqiao.quartz.task;

import cn.yuanqiao.archive.wenjianzhengli.service.ITenantYqdaDocumentService;
import cn.yuanqiao.common.utils.DateUtils;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.quartz.mapper.SysJobMapper;
import cn.yuanqiao.quartz.util.MethodDescription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author zjj
 * @date 2023/8/9
 */
@Component("docTask")
public class DocTask {
    private static final Logger log = LoggerFactory.getLogger(DocTask.class);

    @Autowired
    private ITenantYqdaDocumentService yqdaDocumentService;

    @MethodDescription("格式转换定时任务，arg0需要传入tenantCode")
    public void docTask(String tenantCode)
    {
        if(StringUtils.isNotEmpty(tenantCode)){
            Date start = new Date();
            log.info("定时转换任务开始="+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,start));
            yqdaDocumentService.docToOfdTask(tenantCode);
            Date end = new Date();
            log.info("定时转换任务结束="+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,end));
            log.info("耗时="+(end.getTime()-start.getTime())+"毫秒");
        }else {
            log.error("TenantCode is null");
        }
    }
}
